cli: migrate from pico-args to clap 4.x derive API#395
Conversation
Replace the flat Args struct and manual parse_args() function with clap's derive-based subcommand parsing. Each subcommand now declares exactly the arguments it accepts, making the CLI self-documenting for both humans and AI agents. Key changes: - Subcommands (simulate, convert, equations, debug, gen-stdlib, vdf-dump) are now a proper enum with per-variant fields - Shared model-input args (path + format) use #[command(flatten)] - Input format auto-detected from file extension (.mdl, .pb/.bin) with explicit --format override - Mutually exclusive --to-xmile/--to-mdl replaced by --to enum - --reference on debug is enforced required at parse time by clap - New open_model() helper centralizes format-dispatch logic Also fixes lint-project.sh to use a temp file instead of process substitution, which requires /dev/fd and fails in some environments. https://claude.ai/code/session_017qMQ634tovdKLeQmYgQMAm
Code ReviewReviewed the migration from pico-args to clap 4.x derive API, the No bugs found. The refactoring is a clean 1:1 behavioral migration with some nice improvements:
Overall correctness: Correct. The patch preserves existing behavior, the argument structure maps cleanly to the old flags, and no existing code paths are broken by the migration. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #395 +/- ##
==========================================
+ Coverage 76.92% 77.00% +0.08%
==========================================
Files 143 143
Lines 36549 36511 -38
==========================================
+ Hits 28115 28116 +1
+ Misses 8434 8395 -39 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@codex review |
|
Codex Review: Something went wrong. Try again later by commenting “@codex review”. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Replace the flat Args struct and manual parse_args() function with
clap's derive-based subcommand parsing. Each subcommand now declares
exactly the arguments it accepts, making the CLI self-documenting for
both humans and AI agents.
Key changes:
are now a proper enum with per-variant fields
with explicit --format override
Also fixes lint-project.sh to use a temp file instead of process
substitution, which requires /dev/fd and fails in some environments.
https://claude.ai/code/session_017qMQ634tovdKLeQmYgQMAm